package com.gpipe.tools;

/**
 * Created by admin on 2017/7/31.
 * 说明：清单汇总层的model
 */
public class SignalList implements Cloneable {
    private String lac;
    private String ci;
    private String startTime;
    private String endTime;
    private String nbr;
    private String date;
    private String hour;
    private String timePeriod;

    public String getTimePeriod() {
        return timePeriod;
    }

    public void setTimePeriod(String timePeriod) {
        this.timePeriod = timePeriod;
    }

    public String getHour() {
        return hour;
    }

    public void setHour(String hour) {
        this.hour = hour;
    }

    public Long getDuration() {
        if (GpipeInit.isNotEmpty(this.endTime) && GpipeInit.isNotEmpty(this.startTime)) {
            return GpipeInit.duration(this.endTime, this.startTime);
        } else
            return Long.valueOf(-1);
    }

    @Override
    public SignalList clone() {
        SignalList stu = null;
        try {
            stu = (SignalList) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return stu;
    }


    public SignalList() {
    }

    public String toString() {
        return this.date + ":" + this.nbr + ":" + this.lac + ":" + this.ci + ":" + this.startTime + ":" + this.endTime;

    }


    public SignalList(String lac, String ci, String nbr, String startTime, String endTime, String timePeriod) {
        this.lac = lac;
        this.ci = ci;
        this.nbr = nbr;
        this.startTime = startTime;
        this.endTime = endTime;
        this.date = startTime.substring(0, 8);
        this.hour = startTime.substring(8, 10);
        this.timePeriod = timePeriod;
    }

    public boolean isLife() {
        String time = this.startTime.substring(8, 12);
        return Long.parseLong(time) > 0 && Long.parseLong(time) < 700;
    }

    public boolean isWork() {
        String time = this.startTime.substring(8, 12);
        return Long.parseLong(time) > 700 && Long.parseLong(time) < 1800;
    }

    public String getLacCi() {
        return lac + "|" + ci;
    }

    public String getLac() {
        return lac;
    }

    public void setLac(String lac) {
        this.lac = lac;
    }

    public String getCi() {
        return ci;
    }

    public void setCi(String ci) {
        this.ci = ci;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {

        this.startTime = startTime;
        this.hour = startTime.substring(8, 10);
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public String getNbr() {
        return nbr;
    }

    public void setNbr(String nbr) {
        this.nbr = nbr;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }


}
